<?php
$view_menu = '<div id="menu"><ul id="nav">';
$home = '<li><a href="/"><img src="images/home.png" alt="Home Total Life" /></a></li>';
$menu = $tc->menu(0,2);
$i=0;
while($row = mysql_fetch_array($menu)){ $i++;
	if($i==1) $view_menu .= $home;
	else{
		$view_menu .= '<li><a href="'.$row['url'].'">'.$row['name'].'</a>';
		$view_menu .= $tc->getSubmenu($row['id'],2);
		$view_menu .= '</li>';
	}
}
mysql_free_result($menu);
$search = '<li style="width:192px; height:37px; float:right; margin-right:6px; background:url(images/txtSearch.png) no-repeat"><form action="" name="search" method="post" onSubmit="return SearchGoogle();"><input type="text" name="txtSearch" id="txtSearch" value="Tìm kiếm" onClick="if(value==\'Tìm kiếm\') value=\'\'" onBlur="if(value==\'\') value=\'Tìm kiếm\'" /><input type="button" name="btnSearch" id="btnSearch" onClick="SearchGoogle();" /></form></li>';

$view_menu = $view_menu.$search.'</ul></div>
<script type="text/javascript">
$(document).ready(function(){
	$("#nav li").hover(function(){
		$(this).find("ul:first").css({visibility: "visible", display: "none"}).show(200);
	}, function(){
			$(this).find("ul:first").css({visibility: "hidden"});
	});
});

function SearchGoogle(){
	var key = document.getElementById("txtSearch").value;
	var site = document.domain;
	var qs = key + "+site:" + site;
	var url = "http://www.google.com.vn/#sclient=psy-ab&hl=vi&site=&source=hp&q=" + qs + "&pbx=1&oq=" + qs + "&aq=f&aqi=&aql=1&gs_sm=e";
	window.open(url, "_blank");
	return false;
}
</script>
';